package com.edu.hre.common.utils;

import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import com.edu.hre.struts.action.leave.LeaveRequestUpdateAction;


// test
public class TestMain {

	/**
	 * @param args
	 */
	
	private static final SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
	private static final SimpleDateFormat dateFormat2 = new SimpleDateFormat("dd/MM/yyyy HH:mm");
	
	public static void main(String[] args) throws ParseException { 
//		DecimalFormat df = new DecimalFormat("0.5");
//		float f = 3.1345f;
//		System.out.println(df.format(f));
//		System.out.println(String.valueOf(Character.toChars(65)));
//		float sss = 3.00001f;
//		if((int) (sss/0.5) == sss/0.5)
//			System.out.println("true");
		
		String s = "/asdas.do?sssssssssasdasd";
		System.out.println(s.substring(0, s.indexOf(".do")));
	}
	
	public static Integer computeLeaveDays(Date start, Date end){
		try {
			Date d1 = dateFormat.parse(dateFormat.format(start));
			Date d2 = dateFormat.parse(dateFormat.format(end));
			return (int) ((d2.getTime() - d1.getTime()) / (1000.0 * 60 * 60 * 24));
		} catch (Exception e) {
			CommonUtils.println(e.getMessage());
			return null;
		}
	}
 
}
